package com.imfondof.mvc_mvp_mvvm.mvvm;

import com.imfondof.mvc_mvp_mvvm.bean.Account;
import com.imfondof.mvc_mvp_mvvm.callback.MCallback;

import java.util.Random;

public class MVVMModel {
    //模拟查询账号（数据库操作
    public void getAccountData(String accountName, MCallback callback) {
        Random random = new Random();
        boolean isSuccess = random.nextBoolean();
        if (isSuccess) {
            Account account = new Account(accountName, 100);
            callback.onSuccess(account);
        } else {
            callback.onFailed();
        }
    }
}
